\(\int (f+g x) (a+b \log (c (d+e x)^n))^2 \, dx\) [46]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 186 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=-\frac {2 a b (e f-d g) n x}{e}+\frac {2 b^2 (e f-d g) n^2 x}{e}+\frac {b^2 g n^2 (d+e x)^2}{4 e^2}-\frac {2 b^2 (e f-d g) n (d+e x) \log \left (c (d+e x)^n\right )}{e^2}-\frac {b g n (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )}{2 e^2}+\frac {(e f-d g) (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e^2}+\frac {g (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{2 e^2} \]

[Out]

-2*a*b*(-d*g+e*f)*n*x/e+2*b^2*(-d*g+e*f)*n^2*x/e+1/4*b^2*g*n^2*(e*x+d)^2/e^2-2*b^2*(-d*g+e*f)*n*(e*x+d)*ln(c*(
e*x+d)^n)/e^2-1/2*b*g*n*(e*x+d)^2*(a+b*ln(c*(e*x+d)^n))/e^2+(-d*g+e*f)*(e*x+d)*(a+b*ln(c*(e*x+d)^n))^2/e^2+1/2
*g*(e*x+d)^2*(a+b*ln(c*(e*x+d)^n))^2/e^2

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 186, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.318, Rules used = {2448, 2436, 2333, 2332, 2437, 2342, 2341} \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=\frac {(d+e x) (e f-d g) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e^2}-\frac {b g n (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )}{2 e^2}+\frac {g (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{2 e^2}-\frac {2 a b n x (e f-d g)}{e}-\frac {2 b^2 n (d+e x) (e f-d g) \log \left (c (d+e x)^n\right )}{e^2}+\frac {b^2 g n^2 (d+e x)^2}{4 e^2}+\frac {2 b^2 n^2 x (e f-d g)}{e} \]

[In]

Int[(f + g*x)*(a + b*Log[c*(d + e*x)^n])^2,x]

[Out]

(-2*a*b*(e*f - d*g)*n*x)/e + (2*b^2*(e*f - d*g)*n^2*x)/e + (b^2*g*n^2*(d + e*x)^2)/(4*e^2) - (2*b^2*(e*f - d*g
)*n*(d + e*x)*Log[c*(d + e*x)^n])/e^2 - (b*g*n*(d + e*x)^2*(a + b*Log[c*(d + e*x)^n]))/(2*e^2) + ((e*f - d*g)*
(d + e*x)*(a + b*Log[c*(d + e*x)^n])^2)/e^2 + (g*(d + e*x)^2*(a + b*Log[c*(d + e*x)^n])^2)/(2*e^2)

Rule 2332

Int[Log[(c_.)*(x_)^(n_.)], x_Symbol] :> Simp[x*Log[c*x^n], x] - Simp[n*x, x] /; FreeQ[{c, n}, x]

Rule 2333

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.), x_Symbol] :> Simp[x*(a + b*Log[c*x^n])^p, x] - Dist[b*n*p, In
t[(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, n}, x] && GtQ[p, 0] && IntegerQ[2*p]

Rule 2341

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Log[c*x^
n])/(d*(m + 1))), x] - Simp[b*n*((d*x)^(m + 1)/(d*(m + 1)^2)), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rule 2342

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[(d*x)^(m + 1)*((a + b*Lo
g[c*x^n])^p/(d*(m + 1))), x] - Dist[b*n*(p/(m + 1)), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2436

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))^(p_.), x_Symbol] :> Dist[1/e, Subst[Int[(a + b*Log[c*
x^n])^p, x], x, d + e*x], x] /; FreeQ[{a, b, c, d, e, n, p}, x]

Rule 2437

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))^(p_.)*((f_) + (g_.)*(x_))^(q_.), x_Symbol] :> Dist[1/
e, Subst[Int[(f*(x/d))^q*(a + b*Log[c*x^n])^p, x], x, d + e*x], x] /; FreeQ[{a, b, c, d, e, f, g, n, p, q}, x]
 && EqQ[e*f - d*g, 0]

Rule 2448

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))^(p_)*((f_.) + (g_.)*(x_))^(q_.), x_Symbol] :> Int[Exp
andIntegrand[(f + g*x)^q*(a + b*Log[c*(d + e*x)^n])^p, x], x] /; FreeQ[{a, b, c, d, e, f, g, n, p}, x] && NeQ[
e*f - d*g, 0] && IGtQ[q, 0]

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {(e f-d g) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e}+\frac {g (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e}\right ) \, dx \\ & = \frac {g \int (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx}{e}+\frac {(e f-d g) \int \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx}{e} \\ & = \frac {g \text {Subst}\left (\int x \left (a+b \log \left (c x^n\right )\right )^2 \, dx,x,d+e x\right )}{e^2}+\frac {(e f-d g) \text {Subst}\left (\int \left (a+b \log \left (c x^n\right )\right )^2 \, dx,x,d+e x\right )}{e^2} \\ & = \frac {(e f-d g) (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e^2}+\frac {g (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{2 e^2}-\frac {(b g n) \text {Subst}\left (\int x \left (a+b \log \left (c x^n\right )\right ) \, dx,x,d+e x\right )}{e^2}-\frac {(2 b (e f-d g) n) \text {Subst}\left (\int \left (a+b \log \left (c x^n\right )\right ) \, dx,x,d+e x\right )}{e^2} \\ & = -\frac {2 a b (e f-d g) n x}{e}+\frac {b^2 g n^2 (d+e x)^2}{4 e^2}-\frac {b g n (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )}{2 e^2}+\frac {(e f-d g) (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e^2}+\frac {g (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{2 e^2}-\frac {\left (2 b^2 (e f-d g) n\right ) \text {Subst}\left (\int \log \left (c x^n\right ) \, dx,x,d+e x\right )}{e^2} \\ & = -\frac {2 a b (e f-d g) n x}{e}+\frac {2 b^2 (e f-d g) n^2 x}{e}+\frac {b^2 g n^2 (d+e x)^2}{4 e^2}-\frac {2 b^2 (e f-d g) n (d+e x) \log \left (c (d+e x)^n\right )}{e^2}-\frac {b g n (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )}{2 e^2}+\frac {(e f-d g) (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{e^2}+\frac {g (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2}{2 e^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 144, normalized size of antiderivative = 0.77 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=\frac {4 (e f-d g) (d+e x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2+2 g (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )^2-8 b (e f-d g) n \left (e (a-b n) x+b (d+e x) \log \left (c (d+e x)^n\right )\right )+b g n \left (b e n x (2 d+e x)-2 (d+e x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right )\right )}{4 e^2} \]

[In]

Integrate[(f + g*x)*(a + b*Log[c*(d + e*x)^n])^2,x]

[Out]

(4*(e*f - d*g)*(d + e*x)*(a + b*Log[c*(d + e*x)^n])^2 + 2*g*(d + e*x)^2*(a + b*Log[c*(d + e*x)^n])^2 - 8*b*(e*
f - d*g)*n*(e*(a - b*n)*x + b*(d + e*x)*Log[c*(d + e*x)^n]) + b*g*n*(b*e*n*x*(2*d + e*x) - 2*(d + e*x)^2*(a +
b*Log[c*(d + e*x)^n])))/(4*e^2)

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(458\) vs. \(2(180)=360\).

Time = 0.61 (sec) , antiderivative size = 459, normalized size of antiderivative = 2.47

method result size
parallelrisch \(-\frac {2 x^{2} \ln \left (c \left (e x +d \right )^{n}\right ) b^{2} e^{2} g n -4 x^{2} \ln \left (c \left (e x +d \right )^{n}\right ) a b \,e^{2} g +8 x \ln \left (c \left (e x +d \right )^{n}\right ) b^{2} e^{2} f n -8 x \ln \left (c \left (e x +d \right )^{n}\right ) a b \,e^{2} f -8 \ln \left (c \left (e x +d \right )^{n}\right ) b^{2} d e f n +8 \ln \left (c \left (e x +d \right )^{n}\right ) a b d e f -10 \ln \left (e x +d \right ) b^{2} d^{2} g \,n^{2}-6 b^{2} d^{2} g \,n^{2}-b^{2} e^{2} g \,n^{2} x^{2}+8 b^{2} d e f \,n^{2}+16 \ln \left (e x +d \right ) b^{2} d e f \,n^{2}+4 \ln \left (e x +d \right ) a b \,d^{2} g n -4 \ln \left (c \left (e x +d \right )^{n}\right )^{2} b^{2} d e f +4 \ln \left (c \left (e x +d \right )^{n}\right ) b^{2} d^{2} g n -2 x^{2} \ln \left (c \left (e x +d \right )^{n}\right )^{2} b^{2} e^{2} g -4 x \ln \left (c \left (e x +d \right )^{n}\right )^{2} b^{2} e^{2} f +4 a b \,d^{2} g n +2 a b \,e^{2} g n \,x^{2}+6 b^{2} d e g \,n^{2} x +8 a b \,e^{2} f n x -8 b^{2} e^{2} f \,n^{2} x -8 a b d e f n -4 a b d e g n x -16 \ln \left (e x +d \right ) a b d e f n -2 a^{2} e^{2} g \,x^{2}-4 a^{2} e^{2} f x +4 a^{2} d e f -4 x \ln \left (c \left (e x +d \right )^{n}\right ) b^{2} d e g n +2 \ln \left (c \left (e x +d \right )^{n}\right )^{2} b^{2} d^{2} g}{4 e^{2}}\) \(459\)
risch \(\text {Expression too large to display}\) \(2616\)

[In]

int((g*x+f)*(a+b*ln(c*(e*x+d)^n))^2,x,method=_RETURNVERBOSE)

[Out]

-1/4*(2*x^2*ln(c*(e*x+d)^n)*b^2*e^2*g*n-4*x^2*ln(c*(e*x+d)^n)*a*b*e^2*g+8*x*ln(c*(e*x+d)^n)*b^2*e^2*f*n-8*x*ln
(c*(e*x+d)^n)*a*b*e^2*f-8*ln(c*(e*x+d)^n)*b^2*d*e*f*n+8*ln(c*(e*x+d)^n)*a*b*d*e*f-10*ln(e*x+d)*b^2*d^2*g*n^2-6
*b^2*d^2*g*n^2-b^2*e^2*g*n^2*x^2+8*b^2*d*e*f*n^2+16*ln(e*x+d)*b^2*d*e*f*n^2+4*ln(e*x+d)*a*b*d^2*g*n-4*ln(c*(e*
x+d)^n)^2*b^2*d*e*f+4*ln(c*(e*x+d)^n)*b^2*d^2*g*n-2*x^2*ln(c*(e*x+d)^n)^2*b^2*e^2*g-4*x*ln(c*(e*x+d)^n)^2*b^2*
e^2*f+4*a*b*d^2*g*n+2*a*b*e^2*g*n*x^2+6*b^2*d*e*g*n^2*x+8*a*b*e^2*f*n*x-8*b^2*e^2*f*n^2*x-8*a*b*d*e*f*n-4*a*b*
d*e*g*n*x-16*ln(e*x+d)*a*b*d*e*f*n-2*a^2*e^2*g*x^2-4*a^2*e^2*f*x+4*a^2*d*e*f-4*x*ln(c*(e*x+d)^n)*b^2*d*e*g*n+2
*ln(c*(e*x+d)^n)^2*b^2*d^2*g)/e^2

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 401 vs. \(2 (180) = 360\).

Time = 0.28 (sec) , antiderivative size = 401, normalized size of antiderivative = 2.16 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=\frac {{\left (b^{2} e^{2} g n^{2} - 2 \, a b e^{2} g n + 2 \, a^{2} e^{2} g\right )} x^{2} + 2 \, {\left (b^{2} e^{2} g n^{2} x^{2} + 2 \, b^{2} e^{2} f n^{2} x + {\left (2 \, b^{2} d e f - b^{2} d^{2} g\right )} n^{2}\right )} \log \left (e x + d\right )^{2} + 2 \, {\left (b^{2} e^{2} g x^{2} + 2 \, b^{2} e^{2} f x\right )} \log \left (c\right )^{2} + 2 \, {\left (2 \, a^{2} e^{2} f + {\left (4 \, b^{2} e^{2} f - 3 \, b^{2} d e g\right )} n^{2} - 2 \, {\left (2 \, a b e^{2} f - a b d e g\right )} n\right )} x - 2 \, {\left ({\left (4 \, b^{2} d e f - 3 \, b^{2} d^{2} g\right )} n^{2} + {\left (b^{2} e^{2} g n^{2} - 2 \, a b e^{2} g n\right )} x^{2} - 2 \, {\left (2 \, a b d e f - a b d^{2} g\right )} n - 2 \, {\left (2 \, a b e^{2} f n - {\left (2 \, b^{2} e^{2} f - b^{2} d e g\right )} n^{2}\right )} x - 2 \, {\left (b^{2} e^{2} g n x^{2} + 2 \, b^{2} e^{2} f n x + {\left (2 \, b^{2} d e f - b^{2} d^{2} g\right )} n\right )} \log \left (c\right )\right )} \log \left (e x + d\right ) - 2 \, {\left ({\left (b^{2} e^{2} g n - 2 \, a b e^{2} g\right )} x^{2} - 2 \, {\left (2 \, a b e^{2} f - {\left (2 \, b^{2} e^{2} f - b^{2} d e g\right )} n\right )} x\right )} \log \left (c\right )}{4 \, e^{2}} \]

[In]

integrate((g*x+f)*(a+b*log(c*(e*x+d)^n))^2,x, algorithm="fricas")

[Out]

1/4*((b^2*e^2*g*n^2 - 2*a*b*e^2*g*n + 2*a^2*e^2*g)*x^2 + 2*(b^2*e^2*g*n^2*x^2 + 2*b^2*e^2*f*n^2*x + (2*b^2*d*e
*f - b^2*d^2*g)*n^2)*log(e*x + d)^2 + 2*(b^2*e^2*g*x^2 + 2*b^2*e^2*f*x)*log(c)^2 + 2*(2*a^2*e^2*f + (4*b^2*e^2
*f - 3*b^2*d*e*g)*n^2 - 2*(2*a*b*e^2*f - a*b*d*e*g)*n)*x - 2*((4*b^2*d*e*f - 3*b^2*d^2*g)*n^2 + (b^2*e^2*g*n^2
 - 2*a*b*e^2*g*n)*x^2 - 2*(2*a*b*d*e*f - a*b*d^2*g)*n - 2*(2*a*b*e^2*f*n - (2*b^2*e^2*f - b^2*d*e*g)*n^2)*x -
2*(b^2*e^2*g*n*x^2 + 2*b^2*e^2*f*n*x + (2*b^2*d*e*f - b^2*d^2*g)*n)*log(c))*log(e*x + d) - 2*((b^2*e^2*g*n - 2
*a*b*e^2*g)*x^2 - 2*(2*a*b*e^2*f - (2*b^2*e^2*f - b^2*d*e*g)*n)*x)*log(c))/e^2

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 394 vs. \(2 (177) = 354\).

Time = 0.69 (sec) , antiderivative size = 394, normalized size of antiderivative = 2.12 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=\begin {cases} a^{2} f x + \frac {a^{2} g x^{2}}{2} - \frac {a b d^{2} g \log {\left (c \left (d + e x\right )^{n} \right )}}{e^{2}} + \frac {2 a b d f \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + \frac {a b d g n x}{e} - 2 a b f n x + 2 a b f x \log {\left (c \left (d + e x\right )^{n} \right )} - \frac {a b g n x^{2}}{2} + a b g x^{2} \log {\left (c \left (d + e x\right )^{n} \right )} + \frac {3 b^{2} d^{2} g n \log {\left (c \left (d + e x\right )^{n} \right )}}{2 e^{2}} - \frac {b^{2} d^{2} g \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{2 e^{2}} - \frac {2 b^{2} d f n \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + \frac {b^{2} d f \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{e} - \frac {3 b^{2} d g n^{2} x}{2 e} + \frac {b^{2} d g n x \log {\left (c \left (d + e x\right )^{n} \right )}}{e} + 2 b^{2} f n^{2} x - 2 b^{2} f n x \log {\left (c \left (d + e x\right )^{n} \right )} + b^{2} f x \log {\left (c \left (d + e x\right )^{n} \right )}^{2} + \frac {b^{2} g n^{2} x^{2}}{4} - \frac {b^{2} g n x^{2} \log {\left (c \left (d + e x\right )^{n} \right )}}{2} + \frac {b^{2} g x^{2} \log {\left (c \left (d + e x\right )^{n} \right )}^{2}}{2} & \text {for}\: e \neq 0 \\\left (a + b \log {\left (c d^{n} \right )}\right )^{2} \left (f x + \frac {g x^{2}}{2}\right ) & \text {otherwise} \end {cases} \]

[In]

integrate((g*x+f)*(a+b*ln(c*(e*x+d)**n))**2,x)

[Out]

Piecewise((a**2*f*x + a**2*g*x**2/2 - a*b*d**2*g*log(c*(d + e*x)**n)/e**2 + 2*a*b*d*f*log(c*(d + e*x)**n)/e +
a*b*d*g*n*x/e - 2*a*b*f*n*x + 2*a*b*f*x*log(c*(d + e*x)**n) - a*b*g*n*x**2/2 + a*b*g*x**2*log(c*(d + e*x)**n)
+ 3*b**2*d**2*g*n*log(c*(d + e*x)**n)/(2*e**2) - b**2*d**2*g*log(c*(d + e*x)**n)**2/(2*e**2) - 2*b**2*d*f*n*lo
g(c*(d + e*x)**n)/e + b**2*d*f*log(c*(d + e*x)**n)**2/e - 3*b**2*d*g*n**2*x/(2*e) + b**2*d*g*n*x*log(c*(d + e*
x)**n)/e + 2*b**2*f*n**2*x - 2*b**2*f*n*x*log(c*(d + e*x)**n) + b**2*f*x*log(c*(d + e*x)**n)**2 + b**2*g*n**2*
x**2/4 - b**2*g*n*x**2*log(c*(d + e*x)**n)/2 + b**2*g*x**2*log(c*(d + e*x)**n)**2/2, Ne(e, 0)), ((a + b*log(c*
d**n))**2*(f*x + g*x**2/2), True))

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 314, normalized size of antiderivative = 1.69 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=\frac {1}{2} \, b^{2} g x^{2} \log \left ({\left (e x + d\right )}^{n} c\right )^{2} - 2 \, a b e f n {\left (\frac {x}{e} - \frac {d \log \left (e x + d\right )}{e^{2}}\right )} - \frac {1}{2} \, a b e g n {\left (\frac {2 \, d^{2} \log \left (e x + d\right )}{e^{3}} + \frac {e x^{2} - 2 \, d x}{e^{2}}\right )} + a b g x^{2} \log \left ({\left (e x + d\right )}^{n} c\right ) + b^{2} f x \log \left ({\left (e x + d\right )}^{n} c\right )^{2} + \frac {1}{2} \, a^{2} g x^{2} + 2 \, a b f x \log \left ({\left (e x + d\right )}^{n} c\right ) - {\left (2 \, e n {\left (\frac {x}{e} - \frac {d \log \left (e x + d\right )}{e^{2}}\right )} \log \left ({\left (e x + d\right )}^{n} c\right ) + \frac {{\left (d \log \left (e x + d\right )^{2} - 2 \, e x + 2 \, d \log \left (e x + d\right )\right )} n^{2}}{e}\right )} b^{2} f - \frac {1}{4} \, {\left (2 \, e n {\left (\frac {2 \, d^{2} \log \left (e x + d\right )}{e^{3}} + \frac {e x^{2} - 2 \, d x}{e^{2}}\right )} \log \left ({\left (e x + d\right )}^{n} c\right ) - \frac {{\left (e^{2} x^{2} + 2 \, d^{2} \log \left (e x + d\right )^{2} - 6 \, d e x + 6 \, d^{2} \log \left (e x + d\right )\right )} n^{2}}{e^{2}}\right )} b^{2} g + a^{2} f x \]

[In]

integrate((g*x+f)*(a+b*log(c*(e*x+d)^n))^2,x, algorithm="maxima")

[Out]

1/2*b^2*g*x^2*log((e*x + d)^n*c)^2 - 2*a*b*e*f*n*(x/e - d*log(e*x + d)/e^2) - 1/2*a*b*e*g*n*(2*d^2*log(e*x + d
)/e^3 + (e*x^2 - 2*d*x)/e^2) + a*b*g*x^2*log((e*x + d)^n*c) + b^2*f*x*log((e*x + d)^n*c)^2 + 1/2*a^2*g*x^2 + 2
*a*b*f*x*log((e*x + d)^n*c) - (2*e*n*(x/e - d*log(e*x + d)/e^2)*log((e*x + d)^n*c) + (d*log(e*x + d)^2 - 2*e*x
 + 2*d*log(e*x + d))*n^2/e)*b^2*f - 1/4*(2*e*n*(2*d^2*log(e*x + d)/e^3 + (e*x^2 - 2*d*x)/e^2)*log((e*x + d)^n*
c) - (e^2*x^2 + 2*d^2*log(e*x + d)^2 - 6*d*e*x + 6*d^2*log(e*x + d))*n^2/e^2)*b^2*g + a^2*f*x

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 583 vs. \(2 (180) = 360\).

Time = 0.38 (sec) , antiderivative size = 583, normalized size of antiderivative = 3.13 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx=\frac {{\left (e x + d\right )} b^{2} f n^{2} \log \left (e x + d\right )^{2}}{e} + \frac {{\left (e x + d\right )}^{2} b^{2} g n^{2} \log \left (e x + d\right )^{2}}{2 \, e^{2}} - \frac {{\left (e x + d\right )} b^{2} d g n^{2} \log \left (e x + d\right )^{2}}{e^{2}} - \frac {2 \, {\left (e x + d\right )} b^{2} f n^{2} \log \left (e x + d\right )}{e} - \frac {{\left (e x + d\right )}^{2} b^{2} g n^{2} \log \left (e x + d\right )}{2 \, e^{2}} + \frac {2 \, {\left (e x + d\right )} b^{2} d g n^{2} \log \left (e x + d\right )}{e^{2}} + \frac {2 \, {\left (e x + d\right )} b^{2} f n \log \left (e x + d\right ) \log \left (c\right )}{e} + \frac {{\left (e x + d\right )}^{2} b^{2} g n \log \left (e x + d\right ) \log \left (c\right )}{e^{2}} - \frac {2 \, {\left (e x + d\right )} b^{2} d g n \log \left (e x + d\right ) \log \left (c\right )}{e^{2}} + \frac {2 \, {\left (e x + d\right )} b^{2} f n^{2}}{e} + \frac {{\left (e x + d\right )}^{2} b^{2} g n^{2}}{4 \, e^{2}} - \frac {2 \, {\left (e x + d\right )} b^{2} d g n^{2}}{e^{2}} + \frac {2 \, {\left (e x + d\right )} a b f n \log \left (e x + d\right )}{e} + \frac {{\left (e x + d\right )}^{2} a b g n \log \left (e x + d\right )}{e^{2}} - \frac {2 \, {\left (e x + d\right )} a b d g n \log \left (e x + d\right )}{e^{2}} - \frac {2 \, {\left (e x + d\right )} b^{2} f n \log \left (c\right )}{e} - \frac {{\left (e x + d\right )}^{2} b^{2} g n \log \left (c\right )}{2 \, e^{2}} + \frac {2 \, {\left (e x + d\right )} b^{2} d g n \log \left (c\right )}{e^{2}} + \frac {{\left (e x + d\right )} b^{2} f \log \left (c\right )^{2}}{e} + \frac {{\left (e x + d\right )}^{2} b^{2} g \log \left (c\right )^{2}}{2 \, e^{2}} - \frac {{\left (e x + d\right )} b^{2} d g \log \left (c\right )^{2}}{e^{2}} - \frac {2 \, {\left (e x + d\right )} a b f n}{e} - \frac {{\left (e x + d\right )}^{2} a b g n}{2 \, e^{2}} + \frac {2 \, {\left (e x + d\right )} a b d g n}{e^{2}} + \frac {2 \, {\left (e x + d\right )} a b f \log \left (c\right )}{e} + \frac {{\left (e x + d\right )}^{2} a b g \log \left (c\right )}{e^{2}} - \frac {2 \, {\left (e x + d\right )} a b d g \log \left (c\right )}{e^{2}} + \frac {{\left (e x + d\right )} a^{2} f}{e} + \frac {{\left (e x + d\right )}^{2} a^{2} g}{2 \, e^{2}} - \frac {{\left (e x + d\right )} a^{2} d g}{e^{2}} \]

[In]

integrate((g*x+f)*(a+b*log(c*(e*x+d)^n))^2,x, algorithm="giac")

[Out]

(e*x + d)*b^2*f*n^2*log(e*x + d)^2/e + 1/2*(e*x + d)^2*b^2*g*n^2*log(e*x + d)^2/e^2 - (e*x + d)*b^2*d*g*n^2*lo
g(e*x + d)^2/e^2 - 2*(e*x + d)*b^2*f*n^2*log(e*x + d)/e - 1/2*(e*x + d)^2*b^2*g*n^2*log(e*x + d)/e^2 + 2*(e*x
+ d)*b^2*d*g*n^2*log(e*x + d)/e^2 + 2*(e*x + d)*b^2*f*n*log(e*x + d)*log(c)/e + (e*x + d)^2*b^2*g*n*log(e*x +
d)*log(c)/e^2 - 2*(e*x + d)*b^2*d*g*n*log(e*x + d)*log(c)/e^2 + 2*(e*x + d)*b^2*f*n^2/e + 1/4*(e*x + d)^2*b^2*
g*n^2/e^2 - 2*(e*x + d)*b^2*d*g*n^2/e^2 + 2*(e*x + d)*a*b*f*n*log(e*x + d)/e + (e*x + d)^2*a*b*g*n*log(e*x + d
)/e^2 - 2*(e*x + d)*a*b*d*g*n*log(e*x + d)/e^2 - 2*(e*x + d)*b^2*f*n*log(c)/e - 1/2*(e*x + d)^2*b^2*g*n*log(c)
/e^2 + 2*(e*x + d)*b^2*d*g*n*log(c)/e^2 + (e*x + d)*b^2*f*log(c)^2/e + 1/2*(e*x + d)^2*b^2*g*log(c)^2/e^2 - (e
*x + d)*b^2*d*g*log(c)^2/e^2 - 2*(e*x + d)*a*b*f*n/e - 1/2*(e*x + d)^2*a*b*g*n/e^2 + 2*(e*x + d)*a*b*d*g*n/e^2
 + 2*(e*x + d)*a*b*f*log(c)/e + (e*x + d)^2*a*b*g*log(c)/e^2 - 2*(e*x + d)*a*b*d*g*log(c)/e^2 + (e*x + d)*a^2*
f/e + 1/2*(e*x + d)^2*a^2*g/e^2 - (e*x + d)*a^2*d*g/e^2

Mupad [B] (verification not implemented)

Time = 0.84 (sec) , antiderivative size = 268, normalized size of antiderivative = 1.44 \[ \int (f+g x) \left (a+b \log \left (c (d+e x)^n\right )\right )^2 \, dx={\ln \left (c\,{\left (d+e\,x\right )}^n\right )}^2\,\left (\frac {b^2\,g\,x^2}{2}-\frac {d\,\left (b^2\,d\,g-2\,b^2\,e\,f\right )}{2\,e^2}+b^2\,f\,x\right )+x\,\left (\frac {2\,a^2\,d\,g+2\,a^2\,e\,f-2\,b^2\,d\,g\,n^2+4\,b^2\,e\,f\,n^2-4\,a\,b\,e\,f\,n}{2\,e}-\frac {d\,g\,\left (2\,a^2-2\,a\,b\,n+b^2\,n^2\right )}{2\,e}\right )+\ln \left (c\,{\left (d+e\,x\right )}^n\right )\,\left (\frac {b\,g\,\left (2\,a-b\,n\right )\,x^2}{2}+\left (\frac {2\,b\,\left (a\,d\,g+a\,e\,f-b\,e\,f\,n\right )}{e}-\frac {b\,d\,g\,\left (2\,a-b\,n\right )}{e}\right )\,x\right )+\frac {g\,x^2\,\left (2\,a^2-2\,a\,b\,n+b^2\,n^2\right )}{4}+\frac {\ln \left (d+e\,x\right )\,\left (3\,g\,b^2\,d^2\,n^2-4\,e\,f\,b^2\,d\,n^2-2\,a\,g\,b\,d^2\,n+4\,a\,e\,f\,b\,d\,n\right )}{2\,e^2} \]

[In]

int((f + g*x)*(a + b*log(c*(d + e*x)^n))^2,x)

[Out]

log(c*(d + e*x)^n)^2*((b^2*g*x^2)/2 - (d*(b^2*d*g - 2*b^2*e*f))/(2*e^2) + b^2*f*x) + x*((2*a^2*d*g + 2*a^2*e*f
 - 2*b^2*d*g*n^2 + 4*b^2*e*f*n^2 - 4*a*b*e*f*n)/(2*e) - (d*g*(2*a^2 + b^2*n^2 - 2*a*b*n))/(2*e)) + log(c*(d +
e*x)^n)*(x*((2*b*(a*d*g + a*e*f - b*e*f*n))/e - (b*d*g*(2*a - b*n))/e) + (b*g*x^2*(2*a - b*n))/2) + (g*x^2*(2*
a^2 + b^2*n^2 - 2*a*b*n))/4 + (log(d + e*x)*(3*b^2*d^2*g*n^2 - 4*b^2*d*e*f*n^2 - 2*a*b*d^2*g*n + 4*a*b*d*e*f*n
))/(2*e^2)